﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace OpenMms.Domain.Models
{
    public partial class OpenMmsContext : DbContext
    {
        public OpenMmsContext()
        {
        }

        public OpenMmsContext(DbContextOptions<OpenMmsContext> options)
            : base(options)
        {
        }

        public virtual DbSet<Bouns> Bouns { get; set; }
        public virtual DbSet<MemberLevel> MemberLevel { get; set; }
        public virtual DbSet<Notice> Notice { get; set; }
        public virtual DbSet<ServiceCentre> ServiceCentre { get; set; }
        public virtual DbSet<ShopCart> ShopCart { get; set; }
        public virtual DbSet<UserInforMations> UserInforMations { get; set; }
        public virtual DbSet<UserUpgrade> UserUpgrade { get; set; }

        // Unable to generate entity type for table 'dbo.Parameters'. Please see the warning messages.
        // Unable to generate entity type for table 'dbo.VirtualMoneyApply'. Please see the warning messages.
        // Unable to generate entity type for table 'dbo.Consumption'. Please see the warning messages.
        // Unable to generate entity type for table 'dbo.BusinessLog'. Please see the warning messages.
        // Unable to generate entity type for table 'dbo.RealMoneyApply'. Please see the warning messages.
        // Unable to generate entity type for table 'dbo.Params'. Please see the warning messages.
        // Unable to generate entity type for table 'dbo.MoneyTransfor'. Please see the warning messages.
        // Unable to generate entity type for table 'dbo.UserGiro'. Please see the warning messages.
        // Unable to generate entity type for table 'dbo.Products'. Please see the warning messages.
        // Unable to generate entity type for table 'dbo.Orders'. Please see the warning messages.
        // Unable to generate entity type for table 'dbo.Managers'. Please see the warning messages.
        // Unable to generate entity type for table 'dbo.Messages'. Please see the warning messages.

//        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
//        {
//            if (!optionsBuilder.IsConfigured)
//            {
//#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
//                optionsBuilder.UseSqlServer("Data Source=DESKTOP-D2CCMGU\\SQLEXPRESS; Initial Catalog=OpenMms; Pooling=True; UID=sa;PWD=1234;connect Timeout=10");
//            }
//        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Bouns>(entity =>
            {
                entity.Property(e => e.Amount).HasColumnType("money");

                entity.Property(e => e.CreateDate)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Message)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Type)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<MemberLevel>(entity =>
            {
                entity.Property(e => e.Amount).HasColumnType("money");

                entity.Property(e => e.LevelId).HasColumnName("LevelID");

                entity.Property(e => e.LevelName)
                    .HasMaxLength(255)
                    .IsUnicode(false);

                entity.Property(e => e.TotalAchie).HasColumnType("money");
            });

            modelBuilder.Entity<Notice>(entity =>
            {
                entity.Property(e => e.Author)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.Ncontent).IsUnicode(false);

                entity.Property(e => e.Title)
                    .HasMaxLength(200)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<ServiceCentre>(entity =>
            {
                entity.Property(e => e.Address)
                    .HasMaxLength(255)
                    .IsUnicode(false);

                entity.Property(e => e.Name)
                    .HasMaxLength(255)
                    .IsUnicode(false);

                entity.Property(e => e.ServiceCenterCode)
                    .HasMaxLength(255)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<ShopCart>(entity =>
            {
                entity.Property(e => e.Detail).IsUnicode(false);

                entity.Property(e => e.Price).HasColumnType("money");

                entity.Property(e => e.ProductImage)
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.ProductsName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Total).HasColumnType("money");
            });

            modelBuilder.Entity<UserInforMations>(entity =>
            {
                entity.HasKey(e => e.UserId);

                entity.HasIndex(e => e.UserId)
                    .HasName("UserId")
                    .IsUnique();

                entity.Property(e => e.ActivationTime).HasColumnType("datetime");

                entity.Property(e => e.BankCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.BankName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Bonus)
                    .HasColumnType("decimal(18, 0)")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.CardHolder)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ContactCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ContactId).HasDefaultValueSql("((0))");

                entity.Property(e => e.IdNumber)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Investment)
                    .HasColumnType("money")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.LeftAchie)
                    .HasColumnType("decimal(18, 0)")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.LeftCount).HasDefaultValueSql("((0))");

                entity.Property(e => e.LevelName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Phone)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.RealMoney)
                    .HasColumnType("decimal(18, 0)")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.RefereeCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.RefereeCount).HasDefaultValueSql("((0))");

                entity.Property(e => e.RefereeId).HasDefaultValueSql("((0))");

                entity.Property(e => e.RegistionTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.RightAchie)
                    .HasColumnType("decimal(18, 0)")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.RightCount).HasDefaultValueSql("((0))");

                entity.Property(e => e.SecretAnswer)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.SecurityQuestion)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ServiceCentreCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserPassWord)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserSecondPassWord)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.VirtualMoney)
                    .HasColumnType("decimal(18, 0)")
                    .HasDefaultValueSql("((0))");
            });

            modelBuilder.Entity<UserUpgrade>(entity =>
            {
                entity.Property(e => e.Amount).HasColumnType("decimal(18, 0)");

                entity.Property(e => e.UpgradeDate).HasColumnType("datetime");

                entity.Property(e => e.UserCode)
                    .HasMaxLength(255)
                    .IsUnicode(false);
            });
        }
    }
}
